home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
alib10.zip
/
ALIB3.DOC
< prev
next >
Wrap
Text File
|
1994-04-08
|
101KB
|
2,394 lines
This document contains a list of all ALIB functions arranged alphabetically
by category as follows:
CATEGORY LIBRARY FUNCTIONS IN THIS CATEGORY
-------- -------------------------------------------------------------
compress SHRINK EXPAND
config GET_SETUP CHANGE_SETUP
WRITE_SETUP SET_LIB_COLORS
convert BYTE_TO_DEC_STR BYTE_TO_DEC_CRT DEC_STR_TO_DWORD
DEC_STRZ_TO_DWORD DEC_STRZ_TO_DWORD DEC_STR_TO_WORD
DWORD_TO_DEC_STRX DWORD_TO_DEC_CRTX DWORD_TO_HEX_STR
DWORD_TO_HEX_CRT HEX_ST_TO_BYTE HEX_STR_TO_WORD
WORD_TO_DEC_CRT WORD_TO_DEC_STR WORD_TO_HEX_CRT
WORD_TO_HEX_STR
database DBASE_INIT DBASE_READ
DBASE_READ_NEXT DBASE_READ_PREV DBASE_APPEND
DBASE_INSERT DBASE_REPLACE DBASE_REMOVE
DBASE_CLOSE DBASE_KILL
disk FILE_COPY FILE_SIZE1 FILE_COUNT
FILE_FLUSH FILE_EXIST EXPAND_FILENAME
DECODE_FILENAME FIND_HOME_PATH GET_PATH
CHANGE_PATH RESTORE_PATH FILE_SIZE2
display PUT_CRT_CHR GET_CRT_CHR REPEAT_PUT_CRT
PUT_CRT_BLK VERTICAL_REPEAT_CHR TABULAR_DRAW
CLEAR_SCREEN DISPLAY_STRING DISPLAY_STRING_FILL
DISPLAY_STRING_LIST CLEAR_WINDOW DRAW_BOX
WINDOW_STRING BOX_RIGHT BOX_LEFT
BOX_UP BOX_DOWN BOX_EXPAND
BOX_SHRINK GET_ANSI_COLOR CURSOR_
SHOW_CURSOR HIDE_CURSOR BLINK_ON
BLINK_OFF SAVE_WINDOW RESTORE_WINDOW
DISK_TO_CRT CRT_TO_DISK
error LIB_ERROR_HANDLER ERROR_HANDLER ERROR_NUMBER
ERROR_PRIME ERROR_TABLE_HANDLER ERROR_FILE_HANDLER
SOUND_ON SOUND_OFF ONE_BEEP
BEEP
float FLOAT_OPEN FLOAT_CLOSE BINARY_IN
BINARY_OUT FMOVE F_SUBTRACT
F_ADDITION FCOMP F_MULTIPLY
F_DIVIDE ROUND TEXT_OUT
TEXT_IN FLOAT_SET
memory MEM_OPEN MEM_ALLOCATE MEM_PUT
MEM_GET MEM_RELEASE MEM_CLOSE
DOS_MEM_ALLOCATE DOS_MEM_RELEASE CHECK_FOR_EMS
menu MENU_SYSTEM QMENU_SYSTEM
message MESSAGE RANDOM GET_RANDOM
QMESSAGE QWARN
mouse/key IS_ALPHA IS_DIGIT IS_LOWER
IS_UPPER TO_UPPER TO_LOWER
CAPS_ON NUMLOCK_ON SCROLL_ON
INSERT_OFF CAPS_OFF NUMLOCK_OFF
SCROLL_OFF YES_OR_NO FLUSH_KEYBOARD
KEY_CHECK KEY_READ KEY_PUT
KEY_IF_READY SETUP_MOUSE MOUSE_PARMS
KEY_OR_MOUSE MOVE_MOUSE MAKE_PIXELS
BOX_THE_MOUSE MOUSE_CURSOR_ON MOUSE_CURSOR_OFF
GET_STRING KEY_DECODE QGET_STRING
WINDOW_EDIT WINDOW_CSTRING
parse PARSE_FIRST PARSE_NEXT
string STRLEN1 STRLEN2 STRLEN3
LAST_CHAR LAST_CHARC
FIRST_CHAR FIRST_CHARC BUFFER_SEARCH
BUFFER_SEARCHC STR_SRCHC LAST_STR
LEGAL_CHAR_CHECK
STR_UPPER STR_UPPERC STR_LOWER
STR_LOWERC STR_CENTER STR_LEFT
STR_RIGHT STR_CLEANL STR_CLEANR
STR_REMOVE STR_CHAR_DEL STR_CHAR_DELC
STR_REVERSE STR_REVERSEC STR_SWAP
STR_CLEAN STR_CLEANC STR_JOIN
STR_INSERT STR_COPY STR_COPYC
ILLEGAL_CHAR_CHECK
system LIBRARY_SETUP LIBRARY_TERMINATE FIND_CPU_TYPE
MATH_HARDWARE KEYBOARD_SETUP FIND_MOUSE
CHECK_ANSI DISPLAY_INFO
DETECTVID FIND6845 FIND_DISPLAY_SEGMENT
SPAWN_DOS COUNT_FLOP_DRIVES GET_DRV_TYPE
BREAK_KEY_INTERCEPT BREAK_KEY_RESTORE BREAK_CHECK
time DAYS_TO_DATE MONTH_TO_ASCII DAY_TO_ASCII
GET_TIME ASC_TIME GET_DATE
GET_DAY ASC_DATE DATE_TO_DAYS
Notes: If all registers are saved and then restored by a function,
then the outputs may be listed as "none".
The flag register is always assumed to be changed by the
called function, and the direction flag is sometimes forced
to the "CLD" state.
Many functions require that LIBRARY_SETUP prepare memory or
obtain hardware information first. This is not listed as
one of the function inputs in most cases.
All strings or text are assumed to be zero terminated unless
otherwise specified.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(COMPRESS )
shrink - compress data block
inputs: es:si = feed procedure ptr
es:di = store procedure ptr
dx,ax = size of block of data to be compressed
output: The feed procedure is called with: ds:dx = buffer area
ax = request byte count
The feed procedure returns: ax = byte count of data placed in
buffer.
The store procedure is called with: ds:dx = buffer pointer
ax = buffer size
note: The feed procedure is called whenever the compress module runs
out of data. The store module is called whenever more data is
needed. Normally, the feed and store data uses a disk file, but
if room it could be placed in memory.
See example in file COMPRES.ASM.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(COMPRESS )
expand - expand compressed data back to original state
inputs: es:si = feed procedure (provides compressed data)
es:di = store procedure (recieves uncompressed data blocks)
output: The feed procedure is called with: ds:dx = buffer area
ax = requested byte count
The feed procedure returns: ax = byte count of data placed in
buffer.
The store procedure is called with: ds:dx = buffer pointer
ax = buffer size
note: The feed procedure is called whenever the expand module runs
out of data. The store module is called whenever more data is
needed. Normally, the feed and store data uses a disk file, but
if room is available it could be placed in memory.
See example in file RESTOR.ASM
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONFIG )
GET_SETUP - read setup file from disk
inputs: ds:si = buffer containing default setup block
output: AL = 0 (setup block is ok, input block updated if file found)
1 (setup block is bad)
AH = 0 (setup file was not found, so it was created using defaults)
1 (setup file read from disk)
processing: 0. allocate memory and copy default setup information.
1. build setup file name using executable plus ".CFG"
2. look for existing setup file & use if found
3. if setup not found write defaults to disk
4. parse setup block and build summary_table
5. feed color information to library
notes: GET_SETUP establishes the setup data block for program and
library code.
Building a setup block requires headers and variables. The
headers are displayed by CHANGE_SETUP and allow variables to
grouped by type. Each variable consists of a structure which
is used to define the variable. The header format
is "<<header text>>" followed by a zero character. Up to
six headers can be defined. The variable data is described
by a structure with the following format:
struc variable
db ? ;data type 1=boolean,2=hex,3=decimal,4=color,5=string
db ? ;data length 1=byte,2=word,4=dword, or n for string len
xx ? ;minimum value,used for data types 1,2,3,4 (see note1)
xx ? ;maximum value,used for data types 1,2,3,4 (see note1)
xx ? ;default setting, all data types, strings end with zero
db ? ;description of this variable (string) ending with zero
note1 - the length of minimum value and maximum value fields
depends upon the data types and data length. It will
be a byte for all types except 2 & 3. For 2&3 the
length will track the length field setting.
The setup block must have color descriptions in the first block
and these color descriptions must be in the order needed by
library functions. A typical setup block consisting of two sections
would look like this:
setup_block label byte
db "<<color settings>>",0
db 4,1,0,0ff,1bh,"menu bar text color",0
db 4,1,0,0ff,2bh,"menu bar select color",0
.
.
db "<<setup block 2>>",0
db 1,1,0,1,0,"turn sound on",0 ;yes/no setup
db 2,1,0,0ff,0,"enter hex value",0 ;hex byte
db 3, 0,0, 8,0, 4,0, 'enter decimal word",0 ;decimal word
db 5,15,0,0,"default string",0,"enter string",0
.
db "<<end>>",0
note2 - The length of strings include the zero byte at end.
note3 - For correct order and wording of color setup entries
see sample file EDREC.ASM and EDREC.CFG.
note4 - The colors can also be changed by calling SET_LIB_COLORS
or writing directly to memory using the information returned
from LIBRARY_SETUP and the file COMMON.INC.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONFIG )
CHANGE_SETUP - modify setup data in memory
inputs: none
output: none
processing: 1. allow user to edit the setup buffer
2. give option to write to disk
Notes: The input to this routine is the setup block which
has been processed by GET_SETUP. CHANGE_SETUP can not
be called until GET_SETUP has been executed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONFIG )
WRITE_SETUP - write setup to disk
inputs: ds:si = setup block ptr
cx = setup block length
output: no carry = success
carry = problem creating the file
register changed are: bx,dx
processing: 1. add the checksum to buffer input
2. build filename from executable filename with .CFG added
3. write setup block to current directory location
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONFIG )
SET_LIB_COLORS - set colors to be used by the library
inputs: al = color attributes
bx = color number (position in table)
options available are: defaults:
0 = menu bar text color 07h
1 = menu bar select color 70h
2 = menu bar hotkey color 0Fh (1)
3 = submenu box color 0Fh
4 = submenu selection color
5 = msg text color
6 = msg_hyper_color
7 = pick color
8 = pick selection color
9 = box frame type (see DRAW_BOX) -1
outputs: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
BYTE_TO_HEX_STR - convert hex byte to two ascii characters
inputs: al = hex byte
ds:si = storage buffer for ascii
output: si = points past last store (bumped by 2)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
BYTE_TO_HEX_CRT - convert hex byte to ascii and display
inputs: al = hex byte
ds:si = storage buffer for ascii
output: si = points past last store (bumped by 2)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
DEC_STR_TO_WORD - convert unsigned ascii string to binary word
inputs ds:si points at string ending with "space" or "return"
output ax = binary value
si = updated to point at end of value
carry set if error
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
DEC_STRZ_TO_DWORD - convert numeric asciiz string to double word value
inputs: ds:si = string ptr (string ends with zero)
output: if no carry, dx,ax = number (ax is low word)
if carry, error occurred
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
DEC_STR_TO_DWORD - convert string to double word
inputs: ds:si = string ptr
cx = string length
output: if no carry, dx,ax = number (ax is low word)
if carry, error occurred
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
DWORD_TO_DEC_STR - convert a long integer value to an ASCIIZ string
inputs: DS:[SI] - pointing to a buffer space
DX:AX = long integer value
LONG_TO_STR requires a 12-byte (or greater) buffer
output: ASCIIZ string at DS:[SI]; numerals are right-justified
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
DWORD_TO_HEX_STR - hex double word to ascii
INPUTS: DX,AX = HEX
OUTPUTS: si points past last byte stored
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
DWORD_TO_HEX_CRT - hex double word to ascii and display
INPUTS: DX,AX = HEX
OUTPUTS: NONE
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
DWORD_TO_DEC_STRX - convert dword to decimal ascii with formatting
inputs: dx,ax = binary dword, dx=high word, ax=low word
ds:di = pointer to end of storage buffer.
output: di = pointer to start (left side) of decimal string.
note: The storage buffer must be initialized with all spaces if
leading blanks are utilized.
This routine right justifies the decimal ascii in a buffer
and adds commas between each grouping of three digits.
Normally, this routine is used to display numbers in columns
with right edge lined up.
Beware, the input buffer pointer must point to the end of the
buffer and not the start.
This routine can be used to display right or left justified
numbers by using the buffer start or returned DI.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
DWORD_TO_DEC_CRTX - convert dword to decimal ascii and display
inputs: dx,ax = binary dword, dx=high word, ax=low word
output: none
note: Display cursor should be at right end of area for decimal value.
The value is displayed from right to left and commas added to
separate every 3 characters.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
HEX_STR_TO_BYTE - convert 2 hex ascii characters to 1 hex byte
inputs: ds:si points at hex data
output: no carry - al = hex byte
carry - bad input data
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
HEX_STR_TO_WORD - convert 4 hex ascii characters to 2 hex bytes
inputs: ds:si points at hex data
output: no carry - al = hex word
carry - bad input data
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
WORD_TO_DEC_STR - convert an integer value to an ASCIIZ string
inputs: DS:[SI] pointing to a buffer space
(WORD_TO_STR) AX = integer value
WORD_TO_STR requires a 7-byte (or greater) buffer;
output: ASCIIZ string at DS:[SI]; numerals are right-justified
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
WORD_TO_DEC_CRT - convert word to decimal ascii and display
inputs: ax = binary value
di = display offset
ch = color
outputs: none
registers changed: ax,dx
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
WORD_TO_HEX_STR - convert hex word to four ascii characters
inputs: ax = hex word
ds:si = storage for 4 ascii characters
output: si = pointer past last store (bumped by 4)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
WORD_TO_HEX_CRT - hex word to ascii and display it
inputs: ax = hex word
ds:si = storage for 4 ascii characters
output: si = pointer past last store (bumped by 4)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(DATABASE )
dbase_init - open and initialize an existing or new database
inputs: ds:dx = ptr to asciiz file name
output: no carry + al = 0 (successfully opened an existing database)
carry + al = 1 (new data base created)
carry + al = 3 (insufficient memory to open database)
carry + al = 4 (disk error)
bx = selector needed to access database (segment)
cx = number of records read initially, if zero this is null file.
processing: 1. allocate memory to handle database information
2. open the file or create it if necessary
3. initialize the data area
4. read the first block of data
notes: The database routines are usually called in the following
order: 1. DBASE_INIT
2. database read/write routines
3. dbase_close
The file EDREC.ASM shows examples of database functions.
The file HYPER.ASM shows an example of using database records.
overview: The database routines can handle varable length data records
which end with a zero byte. The zero byte can not occur within
the data area of any record. All data is referenced by record
number which is kept current. When data is inserted, all record
numbers following the inserted data are increased by one.
Conversly, when a record is deleted, all the record numbers
following the deleted record are decreased by one.
Changes or additions to a data file are kept in memory until
memory is filled with changes, at that time they are written
to the file. They are also written if a file access is needed
outside the range of record numbers kept in memory. finally,
when the data file is closed by DBASE_CLOSE, all changes are
written to the data file.
limitations: Record numbers must be within the range 1-65534.
The maximum size of a record is 8181 bytes.
Records can contain data bytes with the values of 01h to 0ffh,
but not a value of 00h. Since ASCII data does not have any
00h values it is the easiest to use with database records.
Opening a database allocates about 36,000 bytes of memory
and requires that two files be opened. Multiple database's
can be opened as long as enough memory and file handles
are available.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(DATABASE )
DBASE_READ - read specific record from the database.
inputs: es = selector from DBASE_INIT
dx = record# to read
output: no carry + al = 00 - if successful, cx=read amount
carry + al = 04 - record not here, could be no records are present
carry + al = 02 - selector bad or database corrupted.
carry + al = 07 - record was too big to fit in memory
carry + al = 08 - unknown error
es:si = ptr to record read (valid only if al=0)
cx = record length including separator character. (present if al=0)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(DATABASE )
dbase_read_next - read next sequential record.
inputs: es = selector from DBASE_INIT
output: no carry or al = 00 - success
carry or al = 01 - record not here, could be no records are present
carry or al = 02 - selector bad or database corrupted.
es:si = ptr to record read (valid only if al=0)
cx = record length including separator character. (present if al=0)
dx = record number
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(DATABASE )
dbase_read_prev - read previous record. (write operations do not affect)
inputs: es = selector from DBASE_INIT
output: no carry or al = 00 - success
carry or al = 01 - record not here, could be no records are present
carry or al = 02 - selector bad or database corrupted.
es:si = ptr to record read (valid only if al=0)
cx = record length including separator character. (present if al=0)
dx = record number
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(DATABASE )
dbase_append - append this record to end of database
inputs: es = selector from DBASE_INIT
ds:di = source data buffer
cx = length of record excluding the separator character
output: no carry, al = 0 (success)
carry or al = 02 - selector bad or database corrupted.
dx = record # assigned
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(DATABASE )
dbase_insert - insert this record before specific record
inputs: es = selector from DBASE_INIT
ds:di = source data buffer
cx = length of record excluding the separator char if present
dx = record number to insert before
output: no carry, al = 0 (success)
carry or al = 01 - record not here, could be no records are present
carry or al = 02 - selector bad or database corrupted.
dx = record number assigned
Note: Inserts are placed in front of the record number input.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(DATABASE )
dbase_replace - replace data for a specific record
inputs: es = selector from DBASE_INIT
ds:di = source data buffer
cx = length of record excluding the separator char if present
dx = record number to insert before
output: no carry, al = 0 (success)
carry or al = 01 - record not here, could be no records are present
carry or al = 02 - selector bad or database corrupted.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(DATABASE )
DBASE_REMOVE - delete specific record
inputs: es = selector from DBASE_INIT
dx = record number to delete
output: no carry, al = 0 (success)
carry or al = 01 - record not here, could be no records are present
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(DATABASE )
dbase_close - close & write any pending data to file
inputs: es = database selector returned by DBASE_INIT
output: no carry, al = 0 (success)
carry or al = 02 - selector bad or database corrupted.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(DATABASE )
dbase_delete - delete dbase file
inputs: ds:dx = asciiz file name ptr
output: carry set if error, error code from DOS function 41h
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISK )
FILE_COPY - copy a file
inputs: DS:[SI] = address of source filename
ES:[DI] = address of destination filename
Both filenames must be ASCIIZ strings.
output: if CF = 0, no problem
if CF = 1, AX = DOS error code (AX = -1 if insufficient memory)
All registers unchanged except for -AX-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISK )
FILE_SIZE1 - find an open file's size
inputs: BX = file handle
output: if CF = 0, DX:AX = file size (low word in AX)
if CF = 1, AX = DOS error code
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISK )
FILE_SIZE2 - find a closed file's size
inputs: DS:DX = pointer to file name asciiz string
output: if CF = 0, DX:AX = file size (low word in AX)
if CF = 1, AX = DOS error code
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISK )
FILE_COUNT - counts the number of files matching an ASCIIZ file spec string.
inputs: DS:[DX] pointing to file spec string
CX = file attributes
output: AX = number of files matching the file spec string
notes: The file spec string may include the '*' and '?' wildcards.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISK )
FILE_FLUSH - flushes the DOS output buffer for specified handle
inputs: BX = file handle
flushing the buffer guards against data loss in case power
outages.
output: if CF = 0, no error; function successful
if CF = 1, AX = DOS error code
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISK )
FILE_EXIST - determines if a file exists and can be opened
inputs: DS:[DX] pointing to ASCIIZ filename
output: if CF = 0, file exists
if CF = 1, AX = DOS error code
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISK )
EXPAND_FILENAME - Expand a file string to the full path including drive.
This is useful for user entered data which needs to
be made consistent for processing. See DECODE_FILENAME.
inputs: DS:[SI] pointing to a filename; the filename may contain
drive specification and/or complete or partial path name.
Drive specification and path name not required.
Path string is terminated with a zero (null) character.
outputs: if no carry then,
DS:[SI] pointing to the full DRIVESPEC:\PATH\FILENAME
CX = length of full filename
if carry is set then filename is bad
Note: The file name is expanded and will overwrite the file name input.
Thus, the file name which is input needs to be in a buffer area
which will accommodate the expansion.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISK )
DECODE_FILENAME - return pointers to major portions of file name
inputs: ds:bx = pointer to file name, use EXPAND_FILENAME to format first
output: if no carry then,
ds:si = pointer to path
ds:di = pointer to filename
cx = path length
dx = filename length
ah = drive letter
al = drive number
if carry, then filename is bad.
Note: The input string should be: <drive letter>:/<path>/<filename>0
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISK )
FIND_HOME_PATH - find the full path and filename of the executing program
inputs: nothing
output: ES:[DI] = pointer to the the name of the executing program
CX = length of path string.
note: The filename returned is an ASCIIZ string, and may be mixed
upper- and lower-case characters.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISK )
GET_PATH - search environment for start of path information string
inputs: nothing
output: ES:DI = pointer to "PATH=" portion of path string.
CX = length of path
note: The path string consists of "PATH=" followed by path entries.
Each path entry is separated with ";" and the last one is
followed by a null character (00h). ES:DI points at
the start of "PATH=".
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISK )
CHANGE_PATH - switch to new directory, but save current path first
inputs: es:bx - points to new path
outputs: old_path has original path
carry set if dos error
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISK )
RESTORE_PATH - switch to directory saved by CHANGE_PATH
inputs: none
output: carry set if dos error
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
PUT_CRT_CHR - display single character
write character (ax) to display at row/column (dx)
inputs: ax = char & color
dx = address
outputs:es = display segment
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
GET_CRT_CHR - read character and attribute from text screen
inputs: DH = screen row
DL = screen column
output: AH = color attribute
AL = ASCII character code
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
REPEAT_PUT_CRT - displays a single char CX times.
inputs: ax = char (ah=color attribute, al=ascii character)
dx = display location (dh=row, dl=column)
cx = count
output: none
notes: The character and color (ax) are displayed starting at
location (dx) until count (cx) is counted down to zero.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
PUT_CRT_BLK - copies a string to video memory buffer, with selected
color attribute;
inputs: CX = maximum number of characters to print
DS:[SI] = pointer to first character of string
ES:[DI] = pointer to video buffer
AH = color attribute
DF = 0 (clear direction flag with CLD)
output: ES:[DI] = pointer to next video buffer display point
DS:[SI] = pointer to byte following last one displayed
notes: registers changed = al,cx,di,si,flags
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
VERTICAL_REPEAT_CHR - repeat one or more columns of a character vertically
inputs: ax = char
dx = row/col
bx = increment to next repeat
cx = char repeat length
si = operation(rows) repeat count
output: registers changed = bx,si,di
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
TABULAR_DRAW - Subroutine to draw using a table tabular_draw
inputs: ah = color
ds:bx = table ptr
table = db repeat count (negative for columns)
db char
db column
db row
above blocks are repeated until ( dw -1) is found.
output: registers changed = ax,bx,cx,dx,si,di
notes: Each table entry can draw a line either horizontally or
vertically.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
CLEAR_SCREEN - fill screen with specified character and color
inputs: AH = color attribute
AL = fill character
output: nothing
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
DISPLAY_STRING - print string directly to video buffer.
inputs: DS:[SI] = pointer to the string
DH = screen row, DL = screen column
AH = color attribute
output: nothing
notes: String must be terminated by a NUL character.
cr/lf characters are handled & wrap to original column.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
DISPLAY_STRING_FILL - display string to screen at specified position.
inputs: DS:[SI] = pointer to the string
cx = maximum length of display line including fill at end
DH = screen row, DL = screen column
AH = color attribute
output: nothing
notes: If string is shorter than the display line length (cx), then
the remainder of the line is cleared.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
DISPLAY_STRING_LIST - display a list of strings
inputs: ds:bx points at table of offsets
ah= color
output: none
notes: ds:bx points to a table of pointers. The end of the table
is indicated by setting an entry to -1. Each table entry
points to an asciiz string.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
CLEAR_WINDOW - fill area of screen
inputs: dx = window position dh=row dl=column
bx = window size bh=rows in window bl=columns in window
AH = color attribute
AL = fill character
output: nothing
notes: The dx,bx registers define a box on the screen in standard
library format (see DRAW_BOX).
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
DRAW_BOX - draw a box on screen
inputs: dx = box address dh=row dl=column
bx = box size dh=rows in box dl=columns in box
AH = color attribute
AL = box frame type 0=single line
1=double line
output: none
notes: The center of the box is cleared as it is drawn.
Box parameters are not checked for illegal sizes so beware.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
WINDOW_STRING - display string in window.
inputs: DS:[SI] = pointer to the string
dx = starting row(dh) starting column(dl)
bx = box total rows(bh) box total columns(bl)
AH = color attribute
outputs: none
notes: String must be terminated with null character.
Strings will wrap if cr/lf is found or edge of box is encountered.
Any area to right of string is cleared up to edge of box.
String which wrap will try not to split words.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
BOX_RIGHT - move box parameters right
inputs: dx = box display address, dh=row dl=column
bx = box size, bh=rows in box bl=columns in box
output: dx = box row (dh) and box column (dl) moved one position
bx = box size, number of rows (bh), number of columns (bl)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
BOX_LEFT - move box parameters left
inputs: dx = box display address, dh=row dl=column
bx = box size, bh=rows in box bl=columns in box
output: dx = box row (dh) and box column (dl) moved one position
bx = box size, number of rows (bh), number of columns (bl)
comment
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
BOX_UP - move box parameters up one position
inputs: dx = box display address, dh=row dl=column
bx = box size, bh=rows in box bl=columns in box
output: dx = box row (dh) and box column (dl) moved one position
bx = box size, number of rows (bh), number of columns (bl)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
BOX_DOWN - move box parameters down one position
inputs: dx = box display address, dh=row dl=column
bx = box size, bh=rows in box bl=columns in box
output: dx = box row (dh) and box column (dl) moved one position
bx = box size, number of rows (bh), number of columns (bl)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
BOX_EXPAND - expand box one position in all directions
inputs: dx = box display address, dh=row dl=column
bx = box size, bh=rows in box bl=columns in box
output: dx = box row (dh) and box column (dl) moved one position
bx = box size, number of rows (bh), number of columns (bl)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
BOX_SHRINK - shrink box parameters one position in all directions
inputs: dx = box display address, dh=row dl=column
bx = box size, bh=rows in box bl=columns in box
output: dx = box row (dh) and box column (dl) moved one position
bx = box size, number of rows (bh), number of columns (bl)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
GET_ANSI_COLOR - get color attribute used by ANSI driver.
inputs: none
output: AH = color attribute
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
CURSOR_ - Move cursor and set size to standard underscore.
inputs: DH = row
DL = column
outputs: register -ax- is modified
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
SHOW_CURSOR - move cursor to (row, col) and update cursor shape
inputs: DH = row offset from top of screen
DL = column offset from left side
outputs: register -ax- modified
notes: Cursor shape is underscore if INSERT is off, large block
if INSERT is on.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
HIDE_CURSOR - make hardware cursor invisible at present location
inputs: none
outputs: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
BLINK_ON: enable blinking attributes
inputs: none
output: none
notes: The opposite of blink is intensified colors. The normal default
is blink on.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
BLINK_OFF: disable blinking attributes
inputs: none
output: none
note: Blink off turns intensified color selection on. The default at
boot time is blink on.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
save_window - save area of display in memory buffer
inputs: dx=box left corner (dh=row,dl=column)
bh=rows in window
bl=columns in window
output: none
processing: save up to three window areas which can be restored
with restore_window. The memory manager is called
to allocate room to store windows saved.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
restore_window - restore a previously saved area of display
inputs: none
output: carry set if error
all registers are saved
processing: restore uses information in save_window to restore the last
window saved. Up to three windows can be saved and then
restored in reverse order.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
DISK_TO_CRT - loads a screen image file saved by CRT_TO_DISK
inputs: DS:[DX] = address of ASCIIZ filename
outputs: if CF = 1, AX = MS-DOS file I/O error code
if CF = 0, no error
registers modified = AX
notes: The input file is assumed to be closed when DISK_TO_CRT is
called, and is left closed upon exit.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( DISPLAY )
CRT_TO_DISK - saves a screen image as a file
inputs: DS:[DX] = address of ASCIIZ filename
outputs: if CF = 1, AX = MS-DOS file I/O error code
if CF = 0, no error
registers modified = AX
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( ERROR )
LIB_ERROR_HANDLER - handle pre defined library errors
inputs: al = error number (see error_index)
ah = flags 80h = fatal_error, abort after display
40h = non_fatal1, return to retry
20h = non_fatal2, return after any key press
10h = fatal_return, fatal error but return after key
08h = spare
04h = spare
02h = spare
01h = spare
output: displayed error message as follows:
1 - Incompatible display mode
2 - Code error, Contact program author for possible
problem resolution
3 - Disk read error, Press any key to continue
4 - Fatal disk error, Press any key
5 - Out of memory, Press any key to abort current operation
6 - Path change failed, Press any key
7 - insufficient DOS memory to run program,
Press any key to abort.
8 - Error in finding/reading quote file QUOTE.DAT
9 - Memory manager transfer error. This is usually
a programming error. Contact the author for assistance.
10 - Open of above file failed, possibly the file does not
exist or is not in correct directory.
11 - The program configuration (.CFG) file is missing an <end>
statement. press any key to continue
note: LIB_ERROR_HANDLER is intended for library use only, but can be
called from application.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( ERROR )
error_handler - handle fatal errors
inputs: ds:si = error text terminated with null character (00).
ah = flags 80h - fatal_error, abort after display
40h - non_fatal1, return to retry
20h - non_fatal2, return after any key press
10h - fatal_return, fatal error but return after key
08h - spare
04h - spare
02h - spare
01h - spare
output: ax = last keypress if a return was requested.
notes: If the abort option is requested, the library will be closed and
the DOS return call executed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( ERROR )
error_prime - setup error handler with additional error information
inputs: ds:bp = table of additional errors used by ERROR_TABLE_HANDLER
ds:di = ptr to file name for use by ERROR_FILE_HANDLER
output: none
note: If either ERROR_TABLE_HANDLER or ERROR_FILE_HANDLER are used
they must first be primed with the error information. Error
files can be built with EDREC and the first record will be
error #1. Similarly a table can be built in memory which
consists of a list of pointers to text strings.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( ERROR )
ERROR_TABLE_HANDLER - handle errors described in table provided by programmer
inputs: ds:si = error text
ah - flags 80h = fatal_error, abort after display
40h = non_fatal1, return to retry
20h = non_fatal2, return after any key press
10h = fatal_return, fatal error but return after key
08h = spare
04h = spare
02h = spare
01h = spare
output: none
Note: ERROR_PRIME must be caller before this routine is accessed
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( ERROR )
ERROR_FILE_HANDLER - handle errors described in file provided by programmer
inputs: ds:si = error text
ah - flags 80h = fatal_error, abort after display
40h = non_fatal1, return to retry
20h = non_fatal2, return after any key press
10h = fatal_return, fatal error but return after key
08h = spare
04h = spare
02h = (future) error_text, ds:bp has message
01h = (future) error_value, bp has error number
output: none
Note: ERROR_PRIME must be called before this routine is accessed
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( ERROR )
SOUND_ON - Enable sounds from BEEP and ONE_BEEP
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( ERROR )
SOUND_OFF - Disable sounds from BEEP and ONE_BEEP
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( ERROR )
one_beep - beep once at 200hz for fraction of a second
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( ERROR )
BEEP make sound for number of milliseconds.
inputs: bx = frequency in HZ
dx = timer ticks
outputs: none
note: Each timer tick is about 1/5 of a second.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
FLOAT_OPEN - open the floating point module & hardware for use
INPUTS: bx = number of tokens (variables) needed by program
OUTPUT: carry set signals error ( no memory ).
notes:
Using this library is different than normal 8087 chip
programming. All numbers (variables) are first assigned
to tokens, then they can be manipulated. When all
calculations are finished the tokens can be extracted by
convert to binary or text. Thus, the normal sequence of
operations is:
1. call library_setup to reserve space for variables (tokens)
2. input all tokens as binary values or text strings using
TEXT_IN,BINARY_IN calls.
3. perform all calculations using add,sub,div,etc. calls.
4. extract results using TEXT_OUT,BINARY_OUT calls.
The FLOAT_OPEN and FLOAT_CLOSE are normally handled by
calls to LIBRARY_OPEN and LIBRARY_CLOSE.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
FLOAT_CLOSE - release the memory allocated by FLOAT_OPEN
inputs: none
outputs: none
note: The FLOAT_OPEN and FLOAT_CLOSE are normally handled by
calls to LIBRARY_OPEN and LIBRARY_CLOSE.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
BINARY_IN - input a value to the floating point module
INPUTS: dx,ax = signed 32 bit number
bx = token number to use for this number. (0-x)
OUTPUT: none
NOTE: The token number must be within the range of tokens reserved
by LIBRARY_OPEN or FLOAT_OPEN. No error checking is performed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
BINARY_OUT - get a binary value from the floating point module
INPUTS: bx = token number
OUTPUT: dx,ax = signed 32 bit number
carry = overflow, number not valid
NOTE: The token number must be within the range of tokens reserved
by LIBRARY_OPEN or FLOAT_OPEN. No error checking is performed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
FMOVE - move a floating value from one token to another
inputs: ax = from token
bx = to token
output: none
note: The token number must be within the range of tokens reserved
by LIBRARY_OPEN or FLOAT_OPEN. No error checking is performed.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
F_SUBTRACT - subtract two floating numbers
INPUTS: token(ax) - token(bx) -> token(cx)
ax = token of operand1
bx = token of operand2
cx = token of accumulator (result)
OUTPUT: token(cx) has result
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
F_ADDITION - add two floating numbers
INPUTS: token(ax) + token(bx) -> token(cx)
ax = token of operand1
bx = token of operand2
cx = token of accumulator (result)
OUTPUT: token(cx) has result
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
FCOMP - compare two floating point numbers
INPUTS: token(ax) compared to token(bx)
OUTPUT: ax -1 (ax bigger bx)
0 (ax = bx)
1 (ax less bx)
(also sets flags for JE,JNE,JG,JGE,JL,JLE)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
F_MULTIPLY - multiply two tokens
INPUTS: token(ax) x token(bx) -> token(cx)
ax = token of operand1
bx = token of operand2
cx = token of accumulator (result)
OUTPUT: token(cx) has result
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
F_DIVIDE - divide one floating number by another
INPUTS: token(ax) / token(bx) -> token(cx)
ax = token of operand1
bx = token of operand2
cx = token of accumulator (result)
OUTPUT: token(cx) has result
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
ROUND - round floating number to nearest 1/100
INPUTS: ax = token of number to be scaled
PROCESSING: token * 100 -> integer /100
NOTE: This function is intended for financial calculations which must
be rounded to nearest penny. The round function will round up
if any value is greater than .xx5
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
TEXT_OUT - convert floating value to text string
INPUTS: token(ax) of number to be converted.
cl = size of output buffer
ch = number of places to right of decimal
es:di = storage point
OUTPUT: es:di ponts at text
NOTE: The size of the output buffer must be large enough to handle
the number and must be larger than the input value in register
ch. If errors are found the output buffer is filled with
"#" characters to indicate that something is wrong.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
TEXT_IN - convert a text string to floating point and assign token
INPUTS: es:di = pointer to text string ending with null character.
ax = token number to assign to text (0-x)
OUTPUT: errors in the text string will result in a value of zero being
entered.
NOTE: Leading spaces or zeros are ignored in the input text string.
The number can have a sign of "+" or "-".
The number can have an exponent specified by using "E" and value
or putting a decimal point "." in the number.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( FLOAT )
FLOAT_SET - signal the presence of floating point hardware
INPUTS: al = lib_info.math_chip setting (0=no chip 1=chip here)
OUTPUT: none
Note: This function not used by library at present.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MEMORY )
MEM_OPEN - interrogate memory and setup database.
inputs: none
output: no carry = success, ax=total 1k blocks allocated
carry = error/warning, if ax=7 DOS memory was not found.
ax=2 fatal programming error
processing: 1. determine memory available and setup database
2. allocate all available memory
Note: DOS memory is required for many library functions so
it must be available. See sample programs for method
needed to make DOS memory available.
This function is called once at the start of a program.
The Library_setup function calls mem_open, so it should
not need to be called directly.
The following calls still need MEM_OPEN & MEM_CLOSE, but
allow the MEM_PUT & MEM_GET calls to be avoided.
DOS_MEM_ALLOCATE - returns segment for direct writes to
allocated memory
DOS_MEM_RELEASE - releases memory allocated with DOS_MEM_ALLOCATE
The memory manager utilizes DOS,XMS, and EMS memory and isolates
the caller from memory manipulation. All interfaces with memory
can be handled through memory manager calls.
The mem_open,mem_allocate, and mem_close are required calls if any
part of the memory manager is utilized. For most efficient
memory allocation always let the memory manager decide where to
allocate memory from, and then use only the memory manager calls
to transfer data. This strategy allows a program to work if any
of the three types of memory is available.
LIMITATIONS - The largest block which can be allocated for use
is 64k
- The maximum number of allocations active at once
is set to 50. Contact author to increase/decrease
- The smallest allocation unit is 1 word
- The maximum amount of memory which can be managed
is about 32mega bytes
Before doing an exec call to DOS it is necessary to do a mem_close
to make memory available. Then, do a mem_open upon return. The
library function SPAWN_DOS is the only function that does an exec
call to DOS. After the mem_close and mem_open sequence all previous
data is lost.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MEMORY )
MEM_ALLOCATE - allocate a block of memory.
inputs: dx,ax=number of bytes to allocate, dx=high word ax=low word
bx=allocation method, 0=normal allocation
1=only allocate DOS memory
outputs: no carry bx=memory mgr handle, use to read/write/release
carry insufficient memory, or too many allocations active
or -bx- not set correctly
note: This function is called each time a new block of memory is needed.
If register BX is set to normal allocation, then the MEM_GET and
MEM_PUT calls must be used to access memory.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MEMORY )
MEM_PUT - write to allocated memory area.
inputs: bx = memory mgr handle
bp:si = ptr to data
di = put location (index from start of block) 0=start of blk
cx = length of bp:si data in words
output: no carry = success
carry = error code in -ax- (from EMS/XMS driver)
note: This function is called to transfer data to allocated memory.
Fatal EMS or XMS transfers are handled internally and
result in an error message display.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MEMORY )
MEM_GET - read from allocated memory area.
inputs: bx = memory mgr handle
bp:di = location to store data
si = get location (index from start of block)
cx = number of words to read
output: no carry = success
carry = error code in -ax- (from EMS/XMS driver)
processing: data is read from the start of block for -cx- bytes
note: This function is called to transfer data from allocated memory.
Fatal EMS or XMS transfers are handled internally and
result in an error message display.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MEMORY )
MEM_RELEASE - release allocated memory block.
inputs: bx = memory mgr handle
output: none
processing: 1. convert packet into free memory.
2. garbage collect on both sides of chain.
note: This function releases blocks of memory which were allocated
by mem_allocate.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MEMORY )
MEM_CLOSE - close memory handler.
inputs: none
output: none
note: This function is called just before the program exits
to return all memory back to the SYSTEM. Normally,
this is accomplished in the LIBRARY_TERMINATE function.
The error_handler will also call this function if a fatal
error causes a direct exit or reboot.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MEMORY )
DOS_MEM_ALLOCATE - allocate dos memory for direct writes
inputs: dx,ax - number of bytes to allocate
output: no carry es = segment of memory allocated
carry = failure allocating memory
note: This function is used only if the program wants to read and
write memory directly. Is is faster than MEM_GET and MEM_PUT
but is limited to DOS memory only.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MEMORY )
DOS_MEM_RELEASE - release memory allocated with DOS_MEM_ALLOCATE
inputs: es = segment of memory to release
output: no carry = success
carry = bad segment
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MEMORY )
CHECK_FOR_EMS: detects EMS driver
inputs: none
output: if CF = 1, no Expanded Memory manager installed
if CF = 0, AH = EMM error code
if AH = 0, BX = page frame segment address
registers changed AX,BX
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MENU )
MENU_SYSTEM - Menu bar display and decode of user selection
inputs: ds:bx - pointer to info structure see COMMON.INC
ah - control flags (see below)
bar_save equ 80h ;save display data under bar
bar_restore equ 40h ;restore display data under bar before exit
bar_display equ 20h ;display the menu bar
wait_valid_key equ 10h ;wait forever till valid key found
return_bad_key equ 08h ;wait for key and return unknown keys
no_mouse_sim equ 04h ;do not simulate mouse with arrow keys
output: cl=0 ax=don't care (none key process occurred)
cl=1 ax=process ptr
cl=2 ax=key (unknown key press)
cl=3 ax=click row/column (unknown mouse click)
cl=4 ax=key (abort key pressed)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MENU )
QMENU_SYSTEM - Quick pulldown menu bar
inputs: ds:bx = pointer to list of names. (See list format below)
output: ah = main menu index, 0=first item, 1=second, etc. -1=abort key
al = sub menu item if present
note: The menu list is displayed on the top line of the screen and is
built as follows:
db 'main option1',0
db 'sub option1',0
db 'sub option2',0
db 0 ;end of main option1
db 'main option2',0
db 0 ;end of main option2
.
.
db 0 ;end of all options.
One zero between strings is a sub menu separation.
two zeros between strings is a new main menu item start
three zeros is end of all strings.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MESSAGE )
message - boxed message display
inputs: al = separator (if flag msg_open)
bh = rows in box (if flag msg_disp)
bl = columns in box (if flag msg_disp)
cx = record # (if flag msg_disp & not msg_rand)
dx = box upper left loc (if flag msg_disp)
ds:si = ptr to file name (if flag msg_open and not msg_ram)
ds:si = ptr to msg text (if flag msg_ram and msg_open)
bp = flags, see equates
es = file selector (if not flag msg_open)
outputs: no carry
es = file selector (if no msg_close flag)
al = yes/no response (if msg_yesno flag was set)
carry
ax = error code xx02 = code error, flag bits in -bp- wrong
xx03 = disk read error
10(decimal) = open error or file not found
note: This function displays a boxed message in various
formats. All messages are found in memory or a file
which uses the database format for variable length ascii
records. A specific message is selected by record #
using the database library routines.
The Hyper text mode uses a special file which is
formatted with records compatible with the database
variable length record format. Each record is
terminated with a zero. The record can contain hyper
triggers to point to other topics(records). The hyper
triggers consist of the following:
byte 0 space <- the trigger word must start with a space
byte 1 1fh <- the special character signals start of hyper
byte 2 n <- binary number which is record# 1-255
byte 3+ ... <- string which is to be highlighted trigger word
byte n space <- trigger word is ended with a space
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MESSAGE )
random - generate random number
inputs: bx = minimum value of random range
bp = maximum value of random range
output: ax = random number
all registers are restored except for -ax-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MESSAGE )
GET_RANDOM - generate random number
inputs: (ds:bx) struc
rs1 dw (random seed 1)
rs2 dw (random seed 2)
range dw mask to truncate number
method db flag 1 = method 1 2=method 2
output: ax = random number
note: GET_RANDOM is designed for applications which need to keep several
random number sequences going independently. Normally, the
RANDOM function is used instead of GET_RANDOM.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MESSAGE )
QMESSAGE - Quick message display in box & wait for keypress (msg in file)
inputs: cx = record # to display.
output: carry set if error reading file on disk. File must be in current
default directory.
note: The display location, colors, and box size is calculated.
The message is obtained from the standard error file, See
ERROR_PRIME for selecting file to use. The message is placed
in a box 10 rows long and 40 columns wide. It waits for any
key before preceding.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( MESSAGE )
QWARN - Quick message display in box & wait for keypress (msg in mem)
inputs: ds:si = pointer to message text, zero at end.
output: none
note: The display location, colors, and box size is calculated.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
IS_ALPHA - check if key returned by KEY_READ is a letter from A-Z or a-z.
inputs: AX = keycode returned by KEY_READ or AH=0, AL=ascii
output: if CF = 0, keycode is a character from A-Z or a-z
if CF = 1, keycode is not a character from A-Z or a-z
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
IS_DIGIT - check if key returned by KEY_READ is the ASCII from 0-9
inputs: AX = keycode returned by KEY_READ or AH=0, AL=ascii
output: if CF = 0, keycode is a character from 0-9
if CF = 1, keycode is not a character from 0-9
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
IS_LOWER - check if key returned by KEY_READ is lower case
inputs: AX = keycode returned by KEY_READ or AH=0, AL=ascii
output: if CF = 1, keycode is not a character from a-z
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
IS_UPPER - check if key returned by KEY_READ is upper case
inputs: AX = keycode returned by KEY_READ or AH=0, AL=ascii
output: if CF = 1, keycode is not a character from A-Z
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
TO_UPPER - converts ascii character to upper case
inputs: AX = keycode returned by KEY_READ or AH=0, AL=ascii
output: AL = upper case ascii
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
TO_LOWER - converts ascii character lower case
inputs: AX = keycode returned by KEY_READ or AH=0, AL=ascii
output: AL = lower case ascii
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
CAPS_ON - Turn the keyboard CAPS LOCK key on
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
NUMLOCK_ON - Turn the keyboard NUM LOCK key on
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
SCROLL_ON - Turn the keyboard SCROLL LOCK key on
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
INSERT_OFF - Turn the keyboard INS key off
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
CAPS_OFF - Turn the keyboard CAPS LOCK key off
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
NUMLOCK_OFF - Turn the keyboard NUM LOCK key off
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
SCROLL_OFF - Turn the keyboard SCROLL LOCK key off
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
YES_OR_NO - wait for yes or no user response
inputs: al - 0=wait for Yes/NO/abort key, and ignore all others
1=wait for Yes/No/abort key, and return others also
outputs: no carry - al = Yes/No ascii character in upper case
carry - al = 03 if abort, and others also if requested
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
FLUSH_KEYBOARD - clears the keyboard's 'type-ahead' buffer
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
KEY_CHECK - check if a key is waiting in the keyboard buffer.
inputs: none
output: AX = 0 if no key waiting
AX = 1 if key waiting
note: if key is found in buffer it is left there and the AX register
is set to one.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
KEY_READ - returns next key pressed
inputs: none
output: if AH = 0 AL = ASCII key code
if AH = 1 AL = scan code
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
KEY_PUT - put key back into BIOS buffer
inputs: ax = key
output: none
Note: If keyboard buffer is full then the key will be ignored.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
KEY_IF_READY - get next key waiting from keyboard
inputs: none
output: AX = 0 if no key waiting
AX = keycode
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
SETUP_MOUSE - initializes mouse driver if mouse present
inputs: none
output: no carry - mouse is initialized
carry - mouse was not found
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
MOUSE_PARMS - determine mouse position & buttons pressed
inputs: none
output: if ZF = 1, no buttons are pressed
if ZF = 0, BX = button code
BX bit 0 if set = left button is down
BX bit 1 if set = right button is down
BX bit 2 if set = center button is down
CX = horizontal (x) coordinate
DX = vertical (y) coordinate
Note that mouse positions are expressed as a pixel location
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
KEY_OR_MOUSE - waits for first keypress or mouse button click
inputs: none
output: AX = keycode, BX = mouse button
note: If a keycode is found it is returned and the mouse status
is not checked.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
MOVE_MOUSE - sets the mouse's position
inputs: dh = text mode row#
dl = text mode column#
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
BOX_THE_MOUSE - limits mouse's range of motion
inputs: dx = box upper left corner (dh=row, dl=column)
bx = box size (bh = number of rows, bl = number of columns)
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
MOUSE_CURSOR_ON - Enable the mouse cursor display
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
MOUSE_CURSOR_OFF - Disable the mouse cursor display
inputs: none
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
GET_STRING - read string from the keyboard.
inputs: es:di - point at buffer for string. Buffer can be preloaded
with default display. pad rest with zeros or spaces.
ah - color for edit line
al - color for edit line at exit time
ch - length of buffer
cl - length of window
dh - window row
dl - window column (starting)
bl - flag 01=numbers only 02h=upper case 04=lower case 08=filename
gs_numbers equ 01h ;get numbers only
gs_upper equ 02h ;get upper case characters
gs_lower equ 04h ;get lower case characters
gs_file equ 08h ;get filename characters only
gs_init equ 10h ;initialize (do once per string entry)
gs_key_wait equ 20h ;input keys till done or unknown key found
gs_key_check equ 40h ;input key only if it is ready
gs_close equ 80h ;remove cursor and deselect string
output: cx - size of string entered (-1=unknown key in -ax-)
ax - last key code if cx=-1
- zero if gs_key_check and all keys processed ok
Note: The buffer length must be equal or greater than the window length
get_string is designed to operate in two modes. The first mode
stays in get_string until the string is entered. This mode requires
the flags: ( gs_init,gs_key_wait,gs_close) and all parameters.
The second mode allows get_string to poll the keyboard along with
other functions. This mode can be used as follows:
1. call with gs_init flag and all parameters.
2. call with gs_key_check until string entered or abort key
3. call with gs_close to remove the cursor and deselect.
Steps 2&3 above only require the flag information in -bl- along
with the get_string call.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
KEY_DECODE - scan for special keys, determine key type and process flags.
inputs: ah=key scan code
al=key ascii code
ds:si=pointer to decode table
output: if cx = 0 then,
al = key ascii code
ah = extended/normal key flag
bx = processing offset (set to normal key if not in table and ah=0)
if cx=-1 then ax = illegal key
note: All keys not in table which have extended flag set are ignored.
Normal keys are processed using control flag supplied by user.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
QGET_STRING - Quick call to get string & return when done
inputs: cl = max string length (buffer length)
dx = display location (dh=row,dl=column)
es:di = pointer to buffer for data storage
output: cx = size of string entered, if -1 then illegal key (ax has key)
ax = if cx = -1 then cx=illegal key code
notes: This routine calls GET_STRING with some standard settings.
For full control use GET_STRING instead.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
WINDOW_EDIT - edit text within window
inputs: bx = window frame size (bh-rows bl=columns)
dx = window position (dh=row dl=column)
ds:si = data for window
cx = size of data buffer (must be larger than window by 20%)
outputs: ah = -1 (abort key pressed)
al = last key press if normal exit
carry set = changes make to buffer
processing: 1. display window data with cursor, then respond
to edit keys: ctrl-c = abort
Enter = break this line
ESC = exit edit mode
right = cursor right
left = cursor left
up = cursor up
down = cursor down
home = cursor to left edge
end = cursor to right edge
del = delete char. under cursor
back = delete & move back
F1 = hyper word select
note: Normal ascii characters are entered into the buffer and
the buffer updated. The state of INS key determines
if characters are inserted or overtype occurs. Illegal
key cause a beep and are ignored.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -(MOUSE/KEY)
WINDOW_CSTRING - display text with hyper formating
inputs: DS:[SI] pointing to the string
ds:[di] points to cursor posn in buffer
dx = starting row(dh) starting column(dl)
bx = box total rows(bh) box total columns(bl)
AH = color attribute (must be msg_text_color)
outputs: table line_table is prepared.
cursor information is updated.
note: WINDOW_CSTRING was written to be used by WINDOW_EDIT to
display in a window and handle hyper words. It does word
wrap and handles cr/lf characters. The window text is
assumed to be terminated with a null character.
Unused portions of the window are cleared.
HYPER triggers are imbedded into the text as two bytes which are
encoded as follows:
first byte 1fh <-character
second byte (record #) <-binary value
HYPER words must begin and end with a space with the HYPER
trigger after the first space. The EDREC utility program
is an easy way to create HYPER entires.
The text must be in a buffer larger than the window to allow
for inserts. It is possible for the text to overflow the
buffer slightly and not show on the display.
The line_info table is built from text scan and is
available as output to callers. Its intended use is
to speed processing of hyper trigger words. The format
of the line_table is:
line_struc struc
line_start dw ? ;ptr to first char. of line
line_end dw ? ;ptr to last char, 0=end of data 0d=cr/lf at end
; n=wrap occurred
chars db ? ;number of chars (minus hyper triggers, cr/lf)
line_no db ? ;line number in range 0-24
line_struc ends
line_tbl_size equ 25
line_table label byte
line_struc<?,?,?,0>
line_struc<?,?,?,01>
line_struc<?,?,?,02>
line_struc<?,?,?,03>
line_struc<?,?,?,04>
line_struc<?,?,?,05>
line_struc<?,?,?,06>
line_struc<?,?,?,07>
line_struc<?,?,?,08>
line_struc<?,?,?,09>
line_struc<?,?,?,10>
line_struc<?,?,?,11>
line_struc<?,?,?,12>
line_struc<?,?,?,13>
line_struc<?,?,?,14>
line_struc<?,?,?,15>
line_struc<?,?,?,16>
line_struc<?,?,?,17>
line_struc<?,?,?,18>
line_struc<?,?,?,19>
line_struc<?,?,?,20>
line_struc<?,?,?,21>
line_struc<?,?,?,22>
line_struc<?,?,?,23>
line_struc<?,?,?,24>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( PARSE )
PARSE_FIRST - parse first argument from command line
inputs: es:di = location to store parsed string
output: es:di = (unchanged) parsed string ptr
cx = length of parsed string (0=no more parameters available)
bh,dx,ax are set as specified by the flag value in -bh-
bh = 0 - end of parameters
1 - single alpha parameter was found of form "\x". The
"x" character was placed in register -bl-
2 - single numeric parameter was found of form "\n". The
"n" binary value was placed in register -bl-
3 - compound alpha parameter of form "\x:yyyy" was found.
register -bl- has "x" character.
4 - compound numeric parameter of form "\x:nnnn" was found.
register -bl- has "x" character, dx,ax has value of nnnn
5 - found alpha string of form "\xxxxx"
6 - found value of form "\nnnn". The decimal value of
nnnn was placed in registers dx,ax
7 - found alpha string of form "xxxx"
8 - found numeric string of form "nnnn". The decimal
value of nnnn was placed in registers dx,ax
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( PARSE )
PARSE_NEXT - parse next command line parameter
inputs: (see PARSE_FIRST)
outputs: (see PARSE_FIRST)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STRLEN1 - finds length of a ASCII string at DS:SI
inputs: DS:[SI] = address of the string
output: CX = length of string excluding the terminating NUL
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STRLEN2 - finds length of a ASCII string at DS:DI
inputs: DS:[DI] = address of the string
output: CX = length of string excluding the terminating NUL
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STRLEN3 - finds length of a ASCII string at DS:BX
inputs: DS:[BX] = address of the string
output: CX = length of string excluding the terminating NUL
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
LAST_CHAR - find the last byte in a string matching register AL
inputs: DS:[BX] pointing to the first character of the string
AL = byte to find
output: if CF = 1, no match
if CF = 0, AX = offset from DS:[BX] of the last matching byte
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
LAST_CHARC - find the last byte in n bytes matching AL
inputs: DS:[BX] pointing to the first character of the string
AL = byte to find
CX = number of bytes to search
output: if CF = 1, no match
if CF = 0, AX = offset from DS:[BX] of the last matching byte
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
FIRST_CHAR - search an ASCIIZ string for a specified character
inputs: DS:[SI] = pointer to ASCIIZ string
AL = character to find
output: if no carry - DI points at match point
if carry - char. was not found
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
FIRST_CHARC - search n bytes of an ASCII string for a specified character
inputs: DS:[SI] = pointer to ASCIIZ string
AL = character to find
CX = number of bytes to search
output: if no carry - DI points at match point
if carry - char. was not found
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
BUFFER_SEARCH - search string1 for the first occurrence of string2
inputs: ES:[DI] pointing to string1
DS:[SI] pointing to string2
output: if no carry - DI = offset of target in source string.
if carry - no match
note: case is ignored. Strings must end with null character (zero).
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
BUFFER_SEACHC - search a buffer for the first occurrence of a string
inputs: ES:[DI] pointing to buffer
DS:[SI] pointing to match-string.
cx = length of buffer
output: if no carry - DI = offset of target in source string.
if carry - no match
note: case is ignored. Match string in DS:SI must end with zero.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_SRCHC - finds the first match with a target string in a source string
inputs: ES:[DI] pointing to source string
DS:[SI] pointing to target string.
output: if CF = 0, BX = offset of target in source string.
if CF = 1, no match
AX, CF; all other flags and registers are saved
note: case of strings must also match.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
LAST_STR - finds the last match with a target string in a source string
inputs: ES:[DI] pointing to source string
DS:[SI] pointing to target string.
output: if no carry - BX = offset of target in source string.
if carry - no match
note: case of strings must also match.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
LEGAL_CHAR_CHECK - scan target string for legal characters
inputs: ds:si = target string ptr
bx = length of string
es:di = legal character list
dx = length of legal char list
output: carry set if invalid character found. ds:si points at character
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
ILLEGAL_CHAR_CHECK - scan string for illegal characters
inputs: ds:si = target string
bx = length of target string
es:di = list of illegal/check characters
dx = length of check list
output: carry set if illegal/check character found. DS:SI point at match.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_UPPER - changes string to upper case
inputs: DS:[SI] pointing to string
output: nothing
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_UPPERC: changes n-length string to upper case
inputs: DS:[SI] pointing to string
CX = number of bytes in string
output: nothing
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_LOWER - changes bytes of a string to lower case
inputs: DS:[SI] = address of an ASCIIZ string
output: nothing
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_LOWERC - changes n bytes of a string to lower case
inputs: DS:[SI] = address of an ASCIIZ string
CX = number of bytes
output: nothing
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_CENTER - centers string1 in a string2
inputs: ES:[DI] = address of string2
DS:[SI] = address of string1
output: CF = 0 if no error
CF = 1 if string was truncated to fit in the field
Note: The length of string2 is determined, then string2 is cleared
to all spaces. String1 is then centered within string2.
Both strings must be null terminated.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_LEFT - left-justifies string1 in string2
inputs: ES:[DI] = address of string2
DS:[SI] = address of string1
output: CF = 0 if no error
CF = 1 if string was truncated to fit in the field
note: string2 is first filled with spaces, then string1 is moved
into string2. Both strings must be null terminated.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_RIGHT - right-justifies a string1 in string2
inputs: ES:[DI] = address of string2
DS:[SI] = address of string1
output: CF = 0 if no error
CF = 1 if string was truncated to fit in the field
note: string2 is first filled with spaces, then string1 is moved
into string2. Both strings must be null terminated.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_CLEANL - remove leading blanks from an ASCIIZ string
inputs: DS:[SI] pointing to string
output: CX = string length
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_CLEANR - removes trailing blanks from string
inputs: DS:[SI] pointing to string
output: CX = string length
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_REMOVE - remove all occurrences of a character from string.
inputs: DS:[SI] = string address
AL = character to remove from the string
output: CX = string length
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_CHAR_DEL - deletes a character from a string
inputs: DS:[SI] points to string
AX = offset from DS:[BX] to character to delete
output: CX = string length
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_CHAR_DELC - deletes a character from a string of n-length
inputs: DS:[SI] pointing to an ASCIIZ string
CX = current string length
AX = offset from DS:[BX] to character to delete
output: CX = string length
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_REVERSE - reverses all characters in a string
inputs: DS:[SI] pointing to the first character of the string
output: CX = string length
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_REVERSEC - reverses n characters in a string
inputs: DS:[SI] pointing to the first character of the string
CX = number of bytes in string to reverse
output: CX = string length
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_SWAP - swaps portions of two strings
inputs: DS:[SI] points to string1
ES:[DI] points to string2
CX = number of bytes to swap
output: nothing
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_SET - sets all bytes of string to a specified character
inputs: DS:[SI] pointing to a string
AL = character
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_SETC - sets n bytes of string to a specified character
inputs: DS:[SI] points to string
AL = character
CX = number of bytes to set
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_JOIN - appends string2 at end of string1
inputs: es:[dI] = address of first string
bx = length of string 1
ds:si = address of second string
dx = length of string 2
output: es:di = new string ptr (unchanged from input DS:SI)
cx = length of joined string at es:di
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_INSERT - inserts string1 in string2 at specified offset.
inputs: DS:[SI] pointing to string1
ES:[DI] pointing to string2
AX = offset in string2 to insert string1
output: none
note: The buffer containing string2 must be large enough for
expansion to the size of string1 plus string2.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_COPY - copy a string to existing buffer
inputs: DS:[SI] pointing to string
ES:[DI] pointing to destination buffer
output: CX = string length
note: The string's terminating NUL byte is also copied.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( STRING )
STR_COPYC - copy CX bytes to an existing buffer
inputs: DS:[SI] pointing to ASCII string
ES:[DI] pointing to destination buffer
CX = number of bytes to copy
output: nothing
note: The string's terminating NUL byte is NOT copied.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
LIBRARY_SETUP - setup library for use
inputs: ax = psp segment
bx = number of floating variables needed
output: es:si = pointer to library info structure
carry = error, library unusable
info struc
cpu_type db ? ;0=88 1=186 2=286 3=386 4=486
math_chip db ? ;0=none 1=8087 2=287 3=387 4=487
mouse_present db ? ;0=no n=yes
crt_type db ? ;
crt_mode db ?
mono_flag db ?
ansi_present db ? ;0=no 1=yes
users_color db ?
crt_seg dw ? ;segment of crt buffer
crt_rows db ? ;
crt_columns db ? ;
key_type db ? ;0=old style 1=enhanced
psp_seg dw ?
info ends
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
LIBRARY_TERMINATE - close out library for program exit
inputs: ax = 0 clear screen at exit
ax = 1 do not clear screen
output: none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
FIND_CPU_TYPE - detects cpu type
inputs: none
output: AX = 0 if 8086/8088
AX = 1 if 80186/80188
AX = 2 if 80286
AX = 3 if 386 (SX or DX)
AX = 4 if 486 (SX or DX)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
MATH_HARDWARE - determines if 80x87 math coprocessor is installed
inputs: none
output: AX = code for 80x87 model
0 = not installed
1 = 8087
2 = 287
3 = 387 (DX or SX)
4 = 487 (486DX or 487SX)
If the coprocessor is present, it is initialized by MATH_HARDWARE.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
keyboard_setup - determine type of keyboard attached
inputs: none
output: al = 0(old style bios) 1(enhanced bios)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
FIND_MOUSE - determines if a mouse is installed
inputs: none
output: AX = number of mouse buttons
AX = 0 if no mouse or mouse driver installed
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
CHECK_ANSI - check if ANSI active
inputs: none
output: CF = 1 if no ANSI driver active
CF = 0 if ANSI active
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
DISPLAY_INFO - determine display information
inputs: none
output: AL = screen rows
CH = screen columns
BX:[SI] = video buffer address
register DX is modified
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
DETECTVID - determine display type
inputs: none
outputs: ax = 0 no display
1 monochrome
2 hercules
3 cga digital (mono)
4 cga analog (mono)
5 cga analog (color)
6 ega mono
7 ega color 64k
8 ega color 64k+
9 cga compatable
10 vga mono
11 vga color
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
FIND_DISPLAY_SEGMENT - scan for current display buffer segment
inputs: display mode 3 or 7 must be set and display page must = 0
output: display_segment is set
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
SPAWN_DOS - execute a second copy DOS
inputs: DS:[SI] points to command tail
See DOS function 4bh for more information on command tail.
if DS:[SI] points to a nul byte, control is transferred
to the second copy of COMMAND.COM and you get a DOS prompt.
control is passed back to the calling program when EXIT is
entered at the DOS prompt.
if DS:[SI] points to a program name string, the program
will be executed, and control will pass back to the calling
program at the termination of the second program.
output: nothing
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
COUNT_FLOP_DRIVES - count the number of floppy disk drives installed
inputs: no parameters
output: AX = number of floppy drives
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
GET_DRV_TYPE - determine drive type
inputs: DL = drive number (0 = drive A:)
output: AX = floppy drive type
0 = invalid drive number
1 = 360k
2 = 1.2M
3 = 720k
4 = 1.44M
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
BREAK_KEY_INTERCEPT - grab keyboard abort keys
inputs: none
output: none
note: BREAK_KEY_INTERCEPT traps Ctrl+Break, Ctrl+C and
Ctrl-Alt-Del key sequences. When one of these
key combinations is pressed, the information is passed
to KEY_READ, KEY_IF_READY, KEY_OR_MOUSE.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
BREAK_KEY_RESTORE - release keyboard abort keys
inputs: no parameters
output: nothing
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( SYSTEM )
BREAK_CHECK - check if break key pressed
inputs: none
output: flags set for je or jz if not set
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( TIME )
DAYS_TO_DATE - build date for the number of days since Jan 1, 1980.
input: AX = days elapsed since January 1, 1980 ("numdays")
output: DX year (1980-2099)
AH month (1-12)
AL day (1-31)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( TIME )
MONTH_TO_ASCII - get ASCII string for specified month
inputs: CX = month (1 - 12, January = 1)
output: ES:[DI] = pointer to month name string
CX = length of month string
Note: the day name string is not zero-terminated
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( TIME )
DAY_TO_ASCII - get string for specified day of the week
inputs: CX = day of week (1 - 7, Sunday = 1)
output: ES:[DI] = pointer to day name string
CX = length of new string
Note: the day name string is not zero-terminated
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( TIME )
GET_TIME - Returns the current SYSTEM time.
input: None
output: DH hours (0-23)
DL minutes (0-59)
AH seconds (0-59)
AL hundredths of seconds (0-99)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( TIME )
ASC_TIME - Creates a time string of the form HH:MM Xm.
input: DS:SI destination string ("string")
Time in dword format ("time"):
DH hours (0-23)
DL minutes (0-59)
output: SI points past last store point
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( TIME )
GET_DATE - Returns the current SYSTEM date and day of the week.
input: None
output: Current SYSTEM date, in dword format:
DX year (1980-2099)
AH month (1-12)
AL day (1-31)
CL day-of-the-week (number of days since Sunday)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( TIME )
GET_DAY - Returns the day of the week for a given date.
input: Date for which day of week should be determined, in dword
DX year (1980-2099)
AH month (1-12)
AL day (1-31)
output: CL day of the week (0-6)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( TIME )
ASC_DATE - Creates a date string of the form MM/DD/YY.
input: DX year (1980-2099)
AH month (1-12)
AL day (1-31)
DS:SI destination string ("string")
output: si points past last character stored.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( TIME )
DATE_TO_DAYS - get number of days between Jan 1, 1980 and a date.
input: DX year (1980-2099)
AH month (1-12)
AL day (1-31)
output: AX days elapsed since January 1, 1980